package com.wealth.system.web.controller;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.wealth.system.web.controller.BaseController;
import com.wealth.wechat.entity.WechatConfig;
import com.wealth.wechat.service.WechatConfigService;

/**
 * 微信菜单入口
 * 功能：获取通过微信号，获取身份 , 为请求添加会员参数
 * 
 * @author chan
 */
@Controller
@RequestMapping(value="/getOpenid")
public class WapgetOpenidController extends BaseController{

	Logger logger = Logger.getLogger(WapgetOpenidController.class);
	
	@Autowired
	private WechatConfigService wechatConfigService;
	
	/** 
	 * 微信菜单入口 
	 */
	@RequestMapping
	public String portal(Model model,HttpServletRequest request) {
		//回调地址
		String returnURL = request.getParameter("returnURL");
		String type = request.getParameter("type");
		model.addAttribute("returnURL", returnURL+"&scopeEnum="+type);
		model.addAttribute("scopeEnum", type);
		//应用ID
		WechatConfig config =  wechatConfigService.getWechatConfigByCorpid(corpid);
		model.addAttribute("appid", config.getWxappid());

		return "getOpenid";
	}
}
